﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using HA.Data;

namespace HA.ModFlow.Controls.UserControls
{
    /// <summary>
    /// ucMultiInputMapData.xaml 的交互逻辑
    /// </summary>
    public partial class ucMultiInputMapData : UserControl
    {
        public ucMultiInputMapData()
        {
            InitializeComponent();
        }

        public static Window mainWindow;
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            List<BCDateData> lst =((BCDateDataCollection)this.DataContext).BCDatas;

            winGridMultiMapData win = new winGridMultiMapData(lst);
            
            win.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            win.Owner = mainWindow;
            if (win.ShowDialog() == true)
            {
                ((BCDateDataCollection)this.DataContext).BCDatas.Clear();
                ((BCDateDataCollection)this.DataContext).BCDatas.AddRange(win.ValueDatas.ToList());

                this.txtnumber.GetBindingExpression(TextBox.TextProperty).UpdateTarget();

                this.txtnumber.GetBindingExpression(TextBox.IsEnabledProperty).UpdateTarget();
            }


            //List<double> lst = (List<double>)this.DataContext;

            //winMultiInput win = new winMultiInput(lst);





            ////win.Owner = this.Parent;
            //win.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            //win.Owner = mainWindow;
            //if (win.ShowDialog() == true)
            //{
            //    this.txtnumber.GetBindingExpression(TextBox.TextProperty).UpdateTarget();

            //    this.txtnumber.GetBindingExpression(TextBox.IsEnabledProperty).UpdateTarget();


            //}
        }
    }
}
